.class Lcom/estrongs/android/scanner/service/f;
.super Landroid/database/ContentObserver;
.source "MediaStoreContentObserver.java"


# static fields
.field private static g:J

.field private static h:J

.field private static i:J

.field private static j:[Ljava/lang/String;


# instance fields
.field private final a:Ljava/util/concurrent/ScheduledThreadPoolExecutor;

.field private final b:Landroid/net/Uri;

.field private final c:Landroid/content/Context;

.field private final d:Ljava/util/List;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;"
        }
    .end annotation
.end field

.field private final e:Lcom/estrongs/android/scanner/service/d;

.field private final f:Ljava/lang/Runnable;


# direct methods
.method public constructor <init>(Landroid/content/Context;Ljava/util/concurrent/ScheduledThreadPoolExecutor;Landroid/os/Handler;Landroid/net/Uri;Ljava/util/List;Lcom/estrongs/android/scanner/service/d;)V
    .locals 0
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            "Ljava/util/concurrent/ScheduledThreadPoolExecutor;",
            "Landroid/os/Handler;",
            "Landroid/net/Uri;",
            "Ljava/util/List<",
            "Ljava/lang/String;",
            ">;",
            "Lcom/estrongs/android/scanner/service/d;",
            ")V"
        }
    .end annotation

    .line 1
    invoke-direct {p0, p3}, Landroid/database/ContentObserver;-><init>(Landroid/os/Handler;)V

    .line 2
    new-instance p3, Lcom/estrongs/android/scanner/service/f$a;

    invoke-direct {p3, p0}, Lcom/estrongs/android/scanner/service/f$a;-><init>(Lcom/estrongs/android/scanner/service/f;)V

    iput-object p3, p0, Lcom/estrongs/android/scanner/service/f;->f:Ljava/lang/Runnable;

    .line 3
    iput-object p2, p0, Lcom/estrongs/android/scanner/service/f;->a:Ljava/util/concurrent/ScheduledThreadPoolExecutor;

    .line 4
    iput-object p1, p0, Lcom/estrongs/android/scanner/service/f;->c:Landroid/content/Context;

    .line 5
    iput-object p4, p0, Lcom/estrongs/android/scanner/service/f;->b:Landroid/net/Uri;

    .line 6
    iput-object p5, p0, Lcom/estrongs/android/scanner/service/f;->d:Ljava/util/List;

    .line 7
    iput-object p6, p0, Lcom/estrongs/android/scanner/service/f;->e:Lcom/estrongs/android/scanner/service/d;

    return-void
.end method

.method static synthetic a(J)J
    .locals 0

    .line 1
    sput-wide p0, Lcom/estrongs/android/scanner/service/f;->g:J

    return-wide p0
.end method

.method static synthetic a(Lcom/estrongs/android/scanner/service/f;)Landroid/content/Context;
    .locals 0

    .line 2
    iget-object p0, p0, Lcom/estrongs/android/scanner/service/f;->c:Landroid/content/Context;

    return-object p0
.end method

.method static synthetic a(Landroid/content/Context;)Landroid/util/Pair;
    .locals 0

    .line 3
    invoke-static {p0}, Lcom/estrongs/android/scanner/service/f;->b(Landroid/content/Context;)Landroid/util/Pair;

    move-result-object p0

    return-object p0
.end method

.method static synthetic b()J
    .locals 2

    .line 1
    sget-wide v0, Lcom/estrongs/android/scanner/service/f;->g:J

    return-wide v0
.end method

.method static synthetic b(J)J
    .locals 0

    .line 2
    sput-wide p0, Lcom/estrongs/android/scanner/service/f;->h:J

    return-wide p0
.end method

.method private static b(Landroid/content/Context;)Landroid/util/Pair;
    .locals 9
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Landroid/content/Context;",
            ")",
            "Landroid/util/Pair<",
            "Ljava/lang/Long;",
            "Ljava/lang/Long;",
            ">;"
        }
    .end annotation

    const/4 v0, 0x2

    new-array v3, v0, [Ljava/lang/String;

    const-string v0, "max(_id)"

    const/4 v7, 0x0

    aput-object v0, v3, v7

    const-string v0, "count(*)"

    const/4 v8, 0x1

    aput-object v0, v3, v8

    const/4 v0, 0x0

    .line 4
    :try_start_0
    invoke-virtual {p0}, Landroid/content/Context;->getContentResolver()Landroid/content/ContentResolver;

    move-result-object v1

    const-string p0, "external"

    invoke-static {p0}, Landroid/provider/MediaStore$Files;->getContentUri(Ljava/lang/String;)Landroid/net/Uri;

    move-result-object v2

    const/4 v4, 0x0

    const/4 v5, 0x0

    const/4 v6, 0x0

    invoke-virtual/range {v1 .. v6}, Landroid/content/ContentResolver;->query(Landroid/net/Uri;[Ljava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/String;)Landroid/database/Cursor;

    move-result-object v0

    if-eqz v0, :cond_1

    .line 5
    invoke-interface {v0}, Landroid/database/Cursor;->moveToFirst()Z

    move-result p0

    if-eqz p0, :cond_1

    .line 6
    invoke-interface {v0, v7}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v1

    .line 7
    invoke-interface {v0, v8}, Landroid/database/Cursor;->getLong(I)J

    move-result-wide v3

    .line 8
    new-instance p0, Landroid/util/Pair;

    invoke-static {v1, v2}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v1

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-direct {p0, v1, v2}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0

    if-eqz v0, :cond_0

    .line 9
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    :cond_0
    return-object p0

    :cond_1
    if-eqz v0, :cond_2

    goto :goto_0

    :catchall_0
    move-exception p0

    goto :goto_1

    :catch_0
    move-exception p0

    .line 10
    :try_start_1
    invoke-virtual {p0}, Ljava/lang/Exception;->toString()Ljava/lang/String;

    move-result-object p0

    invoke-static {p0}, Lcom/estrongs/android/util/n;->b(Ljava/lang/String;)V
    :try_end_1
    .catchall {:try_start_1 .. :try_end_1} :catchall_0

    if-eqz v0, :cond_2

    .line 11
    :goto_0
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 12
    :cond_2
    new-instance p0, Landroid/util/Pair;

    const-wide/16 v0, 0x0

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v2

    invoke-static {v0, v1}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v0

    invoke-direct {p0, v2, v0}, Landroid/util/Pair;-><init>(Ljava/lang/Object;Ljava/lang/Object;)V

    return-object p0

    :goto_1
    if-eqz v0, :cond_3

    .line 13
    invoke-interface {v0}, Landroid/database/Cursor;->close()V

    .line 14
    :cond_3
    throw p0
.end method

.method static synthetic b(Lcom/estrongs/android/scanner/service/f;)Lcom/estrongs/android/scanner/service/d;
    .locals 0

    .line 3
    iget-object p0, p0, Lcom/estrongs/android/scanner/service/f;->e:Lcom/estrongs/android/scanner/service/d;

    return-object p0
.end method

.method static synthetic c()J
    .locals 2

    .line 1
    sget-wide v0, Lcom/estrongs/android/scanner/service/f;->h:J

    return-wide v0
.end method

.method static synthetic c(Lcom/estrongs/android/scanner/service/f;)Landroid/net/Uri;
    .locals 0

    .line 2
    iget-object p0, p0, Lcom/estrongs/android/scanner/service/f;->b:Landroid/net/Uri;

    return-object p0
.end method

.method public static c(Landroid/content/Context;)V
    .locals 2

    const-wide/16 v0, 0x0

    .line 3
    sput-wide v0, Lcom/estrongs/android/scanner/service/f;->i:J

    .line 4
    invoke-static {p0}, Lcom/estrongs/android/scanner/service/f;->b(Landroid/content/Context;)Landroid/util/Pair;

    move-result-object p0

    .line 5
    iget-object v0, p0, Landroid/util/Pair;->first:Ljava/lang/Object;

    check-cast v0, Ljava/lang/Long;

    invoke-virtual {v0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    sput-wide v0, Lcom/estrongs/android/scanner/service/f;->g:J

    .line 6
    iget-object p0, p0, Landroid/util/Pair;->second:Ljava/lang/Object;

    check-cast p0, Ljava/lang/Long;

    invoke-virtual {p0}, Ljava/lang/Long;->longValue()J

    move-result-wide v0

    sput-wide v0, Lcom/estrongs/android/scanner/service/f;->h:J

    const/4 p0, 0x1

    new-array p0, p0, [Ljava/lang/String;

    const/4 v0, 0x0

    const-string v1, "_data"

    aput-object v1, p0, v0

    .line 7
    sput-object p0, Lcom/estrongs/android/scanner/service/f;->j:[Ljava/lang/String;

    return-void
.end method

.method static synthetic d(Lcom/estrongs/android/scanner/service/f;)Ljava/util/List;
    .locals 0

    .line 2
    iget-object p0, p0, Lcom/estrongs/android/scanner/service/f;->d:Ljava/util/List;

    return-object p0
.end method

.method static synthetic d()[Ljava/lang/String;
    .locals 1

    .line 1
    sget-object v0, Lcom/estrongs/android/scanner/service/f;->j:[Ljava/lang/String;

    return-object v0
.end method


# virtual methods
.method public a()Landroid/net/Uri;
    .locals 1

    .line 4
    iget-object v0, p0, Lcom/estrongs/android/scanner/service/f;->b:Landroid/net/Uri;

    return-object v0
.end method

.method public onChange(Z)V
    .locals 4

    .line 1
    iget-object p1, p0, Lcom/estrongs/android/scanner/service/f;->d:Ljava/util/List;

    if-eqz p1, :cond_2

    iget-object v0, p0, Lcom/estrongs/android/scanner/service/f;->e:Lcom/estrongs/android/scanner/service/d;

    if-eqz v0, :cond_2

    invoke-interface {p1}, Ljava/util/List;->isEmpty()Z

    move-result p1

    if-eqz p1, :cond_0

    goto :goto_0

    .line 2
    :cond_0
    sget-wide v0, Lcom/estrongs/android/scanner/service/f;->i:J

    .line 3
    invoke-static {}, Ljava/lang/System;->currentTimeMillis()J

    move-result-wide v2

    sput-wide v2, Lcom/estrongs/android/scanner/service/f;->i:J

    sub-long/2addr v2, v0

    const-wide/16 v0, 0x3e8

    cmp-long p1, v2, v0

    if-gez p1, :cond_1

    return-void

    .line 4
    :cond_1
    iget-object p1, p0, Lcom/estrongs/android/scanner/service/f;->a:Ljava/util/concurrent/ScheduledThreadPoolExecutor;

    iget-object v0, p0, Lcom/estrongs/android/scanner/service/f;->f:Ljava/lang/Runnable;

    const-wide/16 v1, 0x3

    sget-object v3, Ljava/util/concurrent/TimeUnit;->SECONDS:Ljava/util/concurrent/TimeUnit;

    invoke-virtual {p1, v0, v1, v2, v3}, Ljava/util/concurrent/ScheduledThreadPoolExecutor;->schedule(Ljava/lang/Runnable;JLjava/util/concurrent/TimeUnit;)Ljava/util/concurrent/ScheduledFuture;

    :cond_2
    :goto_0
    return-void
.end method
